import { ResponseModel, ResponseStructure } from '@/model/responseModel';
import { RequestServiceProxy } from '@/utils/request';
import {
  CompilationModel,
  DetailsModel,
  GroupModel,
  PointModel,
  RuleModel,
  SchedulingModel,
} from './data';

const _request = new RequestServiceProxy();

// 获取组分页列表
export async function getGroupList(
  param?: GroupModel.groupRequest,
): Promise<ResponseStructure<ResponseModel<GroupModel.groupResponse>>> {
  return await _request.post('/attend/group/page', param);
}

//组查询
export async function queryGroup(
  param: GroupModel.groupRequest,
): Promise<ResponseStructure<GroupModel.groupResponse>> {
  return await _request.post<ResponseStructure<GroupModel.groupResponse>>(
    '/attend/group/query',
    param,
  );
}

//新增组
export async function createGroup(
  param: GroupModel.groupResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/group/create', param);
}

//修改组
export async function updateGroup(
  param: GroupModel.groupResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/group/update', param);
}

//删除组
export async function deleteGroup(
  param: GroupModel.deleteGroupModel,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/group/delete', param);
}

// 获取点分页列表
export async function getPointList(
  param?: PointModel.pointRequest,
): Promise<ResponseStructure<ResponseModel<PointModel.pointResponse>>> {
  return await _request.post('/attend/point/page', param);
}

//点查询
export async function queryPoint(
  param: PointModel.pointRequest,
): Promise<ResponseStructure<PointModel.pointResponse>> {
  return await _request.post<ResponseStructure<PointModel.pointResponse>>(
    '/attend/point/query',
    param,
  );
}

//新增点
export async function createPoint(
  param: PointModel.pointResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/point/create', param);
}

//修改点
export async function updatePoint(
  param: PointModel.pointResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/point/update', param);
}

//删除点
export async function deletePoint(
  param: PointModel.deletePointModel,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/point/delete', param);
}

// 获取规则分页列表
export async function getRuleList(
  param?: RuleModel.ruleRequest,
): Promise<ResponseStructure<ResponseModel<RuleModel.ruleResponse>>> {
  return await _request.post('/attend/rule/page', param);
}

//规则查询
export async function queryRule(
  param: RuleModel.ruleRequest,
): Promise<ResponseStructure<RuleModel.ruleResponse>> {
  return await _request.post<ResponseStructure<RuleModel.ruleResponse>>(
    '/attend/rule/query',
    param,
  );
}

//新增规则
export async function createRule(param: RuleModel.ruleResponse): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/rule/create', param);
}

//修改规则
export async function updateRule(param: RuleModel.ruleResponse): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/rule/update', param);
}

//删除规则
export async function deleteRule(
  param: RuleModel.deleteRuleModel,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/rule/delete', param);
}

// 获取排班分页列表
export async function getSchedulingList(
  param?: SchedulingModel.schedulingRequest,
): Promise<ResponseStructure<ResponseModel<SchedulingModel.schedulingResponse>>> {
  return await _request.post('/attend/scheduling/page', param);
}

//排班查询
export async function queryScheduling(
  param: SchedulingModel.schedulingRequest,
): Promise<ResponseStructure<SchedulingModel.schedulingResponse>> {
  return await _request.post<ResponseStructure<SchedulingModel.schedulingResponse>>(
    '/attend/scheduling/query',
    param,
  );
}

//新增排班
export async function createScheduling(
  param: SchedulingModel.schedulingResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/scheduling/create', param);
}

//修改排班
export async function updateScheduling(
  param: SchedulingModel.schedulingResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/scheduling/update', param);
}

//删除排班
export async function deleteScheduling(
  param: SchedulingModel.deleteSchedulingModel,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/scheduling/delete', param);
}

// 获取明细分页列表
export async function getDetailsList(
  param?: DetailsModel.detailsRequest,
): Promise<ResponseStructure<ResponseModel<DetailsModel.detailsResponse>>> {
  return await _request.post('/attend/details/page', param);
}

//明细查询
export async function queryDetails(
  param: DetailsModel.detailsRequest,
): Promise<ResponseStructure<DetailsModel.detailsResponse>> {
  return await _request.post<ResponseStructure<DetailsModel.detailsResponse>>(
    '/attend/details/query',
    param,
  );
}

//新增明细
export async function createDetails(
  param: DetailsModel.detailsResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/details/create', param);
}

//修改明细
export async function updateDetails(
  param: DetailsModel.detailsResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/details/update', param);
}

//删除明细
export async function deleteDetails(
  param: DetailsModel.deleteDetailsModel,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/details/delete', param);
}

// 获取汇总分页列表
export async function getCompilationList(
  param?: CompilationModel.compilationRequest,
): Promise<ResponseStructure<ResponseModel<CompilationModel.compilationResponse>>> {
  return await _request.post('/attend/compilation/page', param);
}

//汇总查询
export async function queryCompilation(
  param: CompilationModel.compilationRequest,
): Promise<ResponseStructure<CompilationModel.compilationResponse>> {
  return await _request.post<ResponseStructure<CompilationModel.compilationResponse>>(
    '/attend/compilation/query',
    param,
  );
}

//新增汇总
export async function createCompilation(
  param: CompilationModel.compilationResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/compilation/create', param);
}

//修改汇总
export async function updateCompilation(
  param: CompilationModel.compilationResponse,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/compilation/update', param);
}

//删除汇总
export async function deleteCompilation(
  param: CompilationModel.deleteCompilationModel,
): Promise<ResponseStructure<void>> {
  return await _request.post<ResponseStructure<void>>('/attend/compilation/delete', param);
}
